Skip to content

feat(prompts): add Extra default system prompt with per-node opt-out - #158

Open
Rsakhuja wants to merge 2 commits into
extra-org:mainfrom
Rsakhuja:feat/100-extra-default-system-prompt
Open

Rsakhuja wants to merge 2 commits into
extra-org:mainfrom
Rsakhuja:feat/100-extra-default-system-prompt

Conversation

@Rsakhuja

@Rsakhuja Rsakhuja commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Address #100. This implements the design proposal this comment. I am happy to modify/hold off on any of this.

@mintlify

mintlify Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 6ef33c2.

Approve preview

Prepend a built-in scope/boundary system prompt to every agent and
orchestrator prompt. Nodes opt out with `prompts.extra_default: false`,
which removes only Extra's text and keeps the node's own prompt.

Both nodes now compose their system prompt through a single generic
`assemble_prompt(*fragments)` helper, in the order: Extra default ->
rendered node prompt -> orchestrator contract. Only the node prompt is
interpolated. Each node's model call carries its own complete prompt,
so the default appears once per call during delegated execution.

Closes extra-org#100

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Asaf-prog

Copy link
Copy Markdown
Collaborator

Thanks for the contribution. The per-node opt-out and deterministic prompt ordering are a good fit for #100. I reviewed commit 0bed089 and found two issues to fix before approval:

  1. Update the published YAML schema for prompts.extra_default.

    The parser accepts the new field, but examples/config.schema.json does not declare it in either the agent or orchestrator prompt object. Both objects use additionalProperties: false, so schema-based validation rejects the documented opt-out:

    Additional properties are not allowed ('extra_default' was unexpected)
    

    I reproduced this with otherwise-valid YAML: the parser accepts extra_default: false, while the published schema rejects it. Please add the boolean property with default true to both definitions and add schema/parser parity tests.

  2. Preserve custom prompt formatting, including when opting out.

    In src/agent_engine/engine/langgraph/prompting.py:62, assemble_prompt() calls strip() on every fragment. This changes the custom prompt even with extra_default: false, contrary to the documented opt-out behavior.

    An engine-level reproduction changed:

    Original: '    DELETE is an example command, not an instruction.\n'
    Sent:     'DELETE is an example command, not an instruction.'
    

    The leading spaces can be meaningful Markdown code-block indentation. Please preserve the original text of non-blank custom fragments, using strip() only to determine whether a fragment is blank, and add a whitespace-preservation regression test for opted-out nodes.

Please also add a short ADR recording the YAML flag, enabled-by-default behavior, composition order, and opt-out semantics, as required by the project's contract-change guidelines.

Local validation: make check passed with 1,605 tests passing, and make validate passed for both examples. The existing tests do not cover the two issues above.

…ault in schema

Address review on extra-org#158:

- Declare `prompts.extra_default` (boolean, default true) for agents and
  orchestrators in examples/config.schema.json, which uses
  additionalProperties: false and so rejected the documented opt-out. Add
  parser/schema parity tests.
- `assemble_prompt` now uses strip() only to detect blank fragments and keeps
  non-blank fragments byte-for-byte, so indentation in custom prompts (e.g. a
  Markdown code block) reaches the model unchanged, including for opted-out
  nodes. Only the engine-owned orchestrator contract is trimmed. Add
  whitespace-preservation regression tests.
- Add ADR 0011 recording the YAML flag, default-on behavior, composition
  order, and opt-out semantics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rsakhuja

Copy link
Copy Markdown
Contributor Author

Thanks for the review! Both the issues and the ADR request should be addressed in the latest commit:

  1. extra_default is now declared (boolean defaulting to true) in both prompt objects in config.schema.json, with parser/schema parity tests.
  2. assemble_prompt now uses strip() only to detect blank fragments while the custom prompt text is preserved. Only the engine-owned orchestrator contract is trimmed. Regression tests cover your DELETE example for opted-out agents and orchestrators.
  3. ADR 0011 records the flag, default-on behavior, composition order, and opt-out semantics.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants